<form action="<?php echo $this->createUrl('attachment/upload') ?>" enctype="multipart/form-data" method="post">
<input type="file" name="Filedata" />
<input type="submit" />
</form>
<div class="demo-content">
    <div class="row">
    <div class="span8">
      <div id="J_Uploader" style="width: 1200px;">
      </div>
    </div>
    <div class="ttt"></div>
  </div>
<!-- script start--> 
    <script type="text/javascript">
        BUI.use('bui/uploader',function (Uploader) {
        
      //添加自定义主题
      Uploader.Theme.addTheme('imageView', {
        elCls: 'imageViewTheme',
        //可以设定该主题统一的上传路径
        url: '/admin/attachment/upload',
        queue:{
          //结果的模板，可以根据不同状态进进行设置
          resultTpl: {
            'default': '<div class="default">{filename}</div>',
            'success': '<div class="success" style="width:240px;"><img src="{url}" width="240" /> <input type="hidden" value="{aid}" name="file[]" /></div>',
            'error': '<div class="error"><span class="uploader-error">{msg}</span></div>',
            'progress': '<div class="progress"><div class="bar" style="width:{loadedPercent}%"></div></div>'
          }
        }
      });
 
      var uploader = new Uploader.Uploader({
        //指定使用主题
        //theme: 'imageView',
        type:'flash',
        render: '#J_Uploader',
        //不设时使用主题配置的上传路径
        url: 'http://127.0.0.1:83/admin/attachment/upload'
      }).render();
      //上传成功时会触发46.      
      uploader.on('error', function(ev){
        var result = ev.result;
        $('.ttt').html(result);
        /*
        $.each(result ,function(i,j){
            alert(i);
            alert(j)
        })
        */
        });
    });
    </script>
<!-- script end -->

  </div>